package models

import (
	"time"

	"gorm.io/gorm"
)

// Product 商品表
type Product struct {
	ID        uint           `json:"id" gorm:"primaryKey"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`

	Name        string  `json:"name" gorm:"size:200;not null"`
	Description string  `json:"description" gorm:"type:text"`
	Images      string  `json:"images" gorm:"type:text"` // JSON格式存储多张图片
	Price       float64 `json:"price" gorm:"type:decimal(10,2);not null"`
	Stock       int     `json:"stock" gorm:"default:0"`
	Sales       int     `json:"sales" gorm:"default:0"`
	Sort        int     `json:"sort" gorm:"default:0"`
	Status      int     `json:"status" gorm:"default:1"` // 1:上架 0:下架
}

